import { styled } from 'styled-components';
import sprite_player from '@/assets/img/sprite_icon.png';
import audio_quality_hover from '@/assets/img/audio-quality-hover.png';
import show from '@/assets/img/show.png';

export const PlayerBarAWrapper = styled.div`
  position: fixed;
  bottom: 0;
  height: 53px;
  width: 100%;
  .active {
    display: block;
  }
  &:hover {
    .visible {
      transform: translateY(0);
    }
  }
  .lock {
    transform: translateY(0);
    .vb > a {
      background-position: -100px -380px;
      &:hover {
        background-position: -100px -400px;
      }
    }
  }
  .nolock {
    transform: translateY(90%);
    .vb > a {
      background-position: -80px -380px;
      &:hover {
        background-position: -80px -400px;
      }
    }
  }
  a {
    cursor: pointer;
  }
  .voice-show {
    visibility: visible;
  }
`;

export const PlayerBarWrapper = styled.div`
  height: 53px;
  width: 100%;
  transition: transform 0.3s ease-in-out;
  .bg {
    width: 100%;
    position: absolute;
    height: 53px;
    background-position: 0 0;
    background-repeat: repeat-x;
  }
  .vb {
    position: absolute;
    top: -14px;
    right: 15px;
    width: 52px;
    height: 67px;
    background-position: 0 -380px;
    z-index: 10;
    > a {
      display: inline-block;
      width: 18px;
      height: 18px;
      margin-left: 15px;
      margin-top: 6px;
    }
  }
  .bg_2 {
    position: absolute;
    top: -1px;
    right: 0;
    width: 15px;
    height: 54px;
    background-position: -52px -393px;
    pointer-events: none;
  }
`;

export const PlayerBarContentWrapper = styled.div`
  position: absolute;
  width: 1030px;
  height: 47px;
  bottom: 0;
  left: 50%;
  display: flex;
  transform: translate(-50%, 0);
  .btns {
    width: 137px;
    height: 47px;
    > a {
      display: inline-block;
      width: 28px;
      height: 28px;
      margin-right: 8px;
      margin-bottom: 3px;
    }
    .prev {
      background-position: 0 -130px;
      &:hover {
        background-position: -30px -130px;
      }
    }
    .pause {
      width: 36px;
      height: 36px;
      margin-top: 6px;
      margin-bottom: 0px;
      background-position: 0 -204px;
      &:hover {
        background-position: -40px -204px;
      }
    }
    .play {
      width: 36px;
      height: 36px;
      margin-top: 6px;
      margin-bottom: 0px;
      background-position: 0 -165px;
      &:hover {
        background-position: -40px -165px;
      }
    }
    .nxt {
      background-position: -80px -130px;
      &:hover {
        background-position: -110px -130px;
      }
    }
  }
  .image {
    position: relative;
    width: 34px;
    height: 34px;
    margin: 6px 15px 0 0;
    > img {
      width: 34px;
      height: 34px;
    }
    > a {
      display: inline-block;
      position: absolute;
      left: 0;
      top: 0;
      width: 34px;
      height: 34px;
      background-position: 0 -80px;
    }
  }
`;
export const PlayerWrapper = styled.div`
  width: 581px;
  margin-top: 12px;
  display: flex;
  .song_info {
    position: absolute;
    top: 8px;
    display: grid; /* 使用Grid布局 */
    grid-template-columns: auto auto auto; /* 三列布局 */
    align-items: center; /* 垂直居中对齐 */
    gap: 10px; /* 设置列间距 */
  }

  .song_info > a {
    height: 15px;
    display: inline-block;
    color: #9b9b9b;
    &:first-child {
      color: #e8e8e8;
    }
  }

  .song_info .from_songs {
    background-position: -110px -103px;
    width: 14px;
  }
  .ant-slider {
    width: 466px;
    > .ant-slider-track {
      height: 6px;
      background-color: #c70c0c;
    }
    > .ant-slider-handle {
      width: 22px;
      height: 24px;
      transform: translate(-50%, -20%) !important;
      &::after {
        background: url(${sprite_player}) no-repeat 0 9999px;
        width: 22px;
        height: 24px;
        background-position: 0 -250px;
        box-shadow: 0 0 0 0px;
      }
    }
  }
  > span {
    margin-left: 10px;
    margin-top: 12px;
    color: #797979;
    text-shadow: 0 1px 0 #121212;
    > em {
      color: #a1a1a1;
    }
  }
`;
export const OperWrapper = styled.div`
  width: 87px;
  height: 36px;
  margin-top: 10px;
  > a {
    display: inline-block;
    width: 25px;
    height: 25px;
  }
  .show {
    background: url(${show}) no-repeat;
    &:hover {
      background-position-y: -25px;
    }
  }
  .like {
    background-position: -88px -163px;
    &:hover {
      background-position: -88px -189px;
    }
  }
  .share {
    background-position: -114px -163px;
    &:hover {
      background-position: -114px -189px;
    }
  }
`;

interface CtrlState {
  $playMode: number;
}

export const CtrlWrapper = styled.div<CtrlState>`
  display: flex;
  align-items: center;
  position: relative;
  z-index: 10;
  > a {
    display: inline-block;
    width: 25px;
    height: 25px;
    &:last-child {
      width: 41px;
    }
  }
  .voice {
    background-position: -2px -248px;
    &:hover {
      background-position: -31px -248px;
    }
  }
  .loop {
    background-position: ${(props) => {
      switch (props.$playMode) {
        case 0:
          return '-3px -344px';
        case 1:
          return '-66px -248px';
        case 2:
          return '-66px -344px';
      }
    }};
    &:hover {
      background-position: ${(props) => {
        switch (props.$playMode) {
          case 0:
            return '-33px -344px';
          case 1:
            return '-93px -248px';
          case 2:
            return '-93px -344px;';
        }
      }};
    }
  }
  .play_list {
    display: inline-block;
    width: 59px;
    height: 25px;
    > span {
      background-position: 0 -287px;
    }
    > a {
      display: inline-block;
      background-position: -42px -68px;
      width: 38px;
      padding-left: 21px;
      height: 27px;
      text-align: center;
      line-height: 27px;
      text-decoration: none;
      &:hover {
        background-position: -42px -98px;
      }
    }
  }
  .quality {
    background-position: 0, 0;
    background-size: 45px 30px;
    &:hover {
      background: url(${audio_quality_hover}) no-repeat 0 -2px;
      background-size: 45px 30px;
    }
  }
`;
